<?php
namespace Home\Controller;
class LoginController extends PublicController{
	function index(){
		$this->getip();
        $this->display();
	}
	function login(){
		$log = M("Owner");
		$username = $_POST["username"];
		$password = md5($_POST["password"]);
		$re  = $log->where("username='%s' and password='%s'",array($username,$password))->find();
		if($re){
            session_start();
            $_SESSION["id"]=$re["id"];
            $_SESSION["username"]=$username;
			 $this->success("登陆成功！",U("Index/index"));
		}else{
			$this->error("账号密码错误",U("Login/index"));
			exit;
		}
	}
   

}